package www.wackyboy.top.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import www.wackyboy.top.Job;
import www.wackyboy.top.service.IJobService;

import java.util.List;

/**
 * @Author: WackyBoy
 * @Date: 2021/3/10 21:43
 */
@Controller
@RequestMapping("/job")
public class JobController {
    @Autowired
    private IJobService jobService;

    @GetMapping("/all")
    public ResponseEntity<List<Job>> searchAllJob() {
        List<Job> jobs = this.jobService.searchAll();
        if(CollectionUtils.isEmpty(jobs)) return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
        else return ResponseEntity.ok(jobs);
    }



}
